In certain trench formation processes in semiconductor fabrication, a phosphosilicate glass/nitride/thermal oxide stack is used as a hard mask for trench etching. After trench formation, only the topmost layer of the trench mask, or the phosphosilicate glass (PSG), should be subsequently stripped by diluted hydrofluoric acid (HF) without damaging the underlying nitride and thermal oxide layers. However, the wet phosphosilicate glass strip also etches and causes undercutting of the thermal oxide. The resulting undercut structure of the thermal oxide may cause or aggravate certain leakage mechanisms in the fabricated semiconductor device. Such leakage phenomena are undesirable and need to be eliminated or greatly reduced. Additional applications include the selective removal of phosphosilicate glass or borophosphosilicate glass (BPSG) from a patterned stack which also contain thermal oxide and/or other similar oxide compositions, such as plasma and nonplasma chemical vapor deposited oxides (CVD), doped and undoped oxides, native oxides, and chemical oxides.